Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pico loader #877

Draft
wants to merge 85 commits into
base: master
Choose a base branch
from
Draft

Pico loader #877

wants to merge 85 commits into from

Conversation

Daft-Freak
Copy link
Collaborator

@Daft-Freak Daft-Freak commented Nov 26, 2024

I finally untangled this!

Building with BLIT_EXECUTABLE_PICO_BLIT=1 creates .blit files instead of .uf2s, these are mostly portable between devices. (The framebuffer size is still set a compile time, so if you have the board set to PicoSystem (the default) the resulting .blit won't run on a device with a > 240x240 display. PicoVision is unaffected by this as its framebuffer is in the PSRAMs)

Installing multiple blits requires manually building them for different offsets (-DBLIT_EXECUTABLE_PICO_BLIT_OFFSET_KB=x), the launcher is built at a lower offset be default. On RP2350-based devices address translation is used to support running blits from any offset. Not much hardware to try that on though...

Some of the CDC API used by the tools is supported and can be used to flash blits onto a PicoSystem. This requires manually specifying the port as the tools don't recognise the VID/PID. (Which should probably be changed to something other than 0xCAFE first).

There's currently no menu but the "hold HOME to exit" feature is there. (If the device has a HOME button... Sorry PicoSystem users.)

Still a lot of missing bits and duplicated logic with the -stm32 port, I have some plans to clean that up a bit. Need to see what it looks like complete first though...

(May edit if I remember more details... Been working on this for > 1.5 years...)

EDIT:

  • flashing has no progress indicator
  • CDC flashing doesn't deduplicate
  • out-of-tree blit builds still build the loader
  • CDC API only has PROG, SAVE, __LS, LNCH and ERSE (no INFO, _RST, SWIT)

@Gadgetoid
Copy link
Contributor

Not much hardware to try that on though...

Might fix that in short order! No controls tho...

@Gadgetoid
Copy link
Contributor

(May edit if I remember more details... Been working on this for > 1.5 years...)

😱

@Daft-Freak
Copy link
Collaborator Author

😱

A lot of that is going to be "distraction time" (or was this the distraction?)... But yeah. https://fosstodon.org/@Daft_Freak/109984773682008272

@Daft-Freak
Copy link
Collaborator Author

Daft-Freak commented Feb 23, 2025

I wonder if we can get a USB PID for "32blit SDK on RP2xxx" 🤔 (Considering that the exposed device is always the same... and the pythons have one).

I'm getting a little tired of doing 32blit flash --port /dev/serial/by-id/usb-TinyUSB_Device_6C89D8A6DE0598AF-if00 list

Edit: the second field in the form being company name would suggest that I cannot...

@ali1234
Copy link
Contributor

ali1234 commented Feb 23, 2025

See https://github.com/raspberrypi/usb-pid

They recommend using iManufacturer and iProduct (which you can set to whatever you want) for devices that have a CDC serial interface.

@Daft-Freak
Copy link
Collaborator Author

Mmm, but this is a composite CDC+MSC device. We're currently defaulting to the very placeholder 0xcafe from the tinyusb examples.

Also it would seem that using the manufacturer/product strings doesn't work on windows. (I only get a manufacturer of "Microsoft" and no product from pyserial)

Right now it's just a BLIT header instead of boot2, built at a 512k
offset to allow launching one thing without position independent code
Seems a bit weird, but needed to get the right framebuffer size
It's... not unusable
Launches the first thing it finds. has some fixed locations for API consts/data.
No update/tick, page-flipping doesn't work, firmware uses 130k RAM
Only builds one at a time, which causes less problems. Controlled by PICO_STANDALONE_UF2/PICO_BLIT in blit_executable or BLIT_EXECUTABLE_PICO_STANDALONE_UF2/BLIT_EXECUTABLE_PICO_BLIT globally
firmware now reserves 32k of RAM (may need less)
larger project for the future: share this code
So that it actually does the thing it's supposed to do
This has been broken since set_framebuffer...
This is the only way for switching between two double-buffered modes to work
It's all low-level stuff the loader should've done
It does things we need to not crash and doesn't do any of the things that caused problems on 2350
This is as big as we can handle with the current translation setup
Avoids faulting when exiting something using audio
The tools assume that any output during this command is an error
Shares a bit with PROG, but a bit simpler
Really useful for sending more than one file...
We didn't need this previously because it never tried to render anything
Currently for progress bars, but maybe a menu later?
the normal render/display update gets a chance to run, so this is easy
This also works with the previous fix
Sometimes we're going to lock out rendering for a while...
Can't display progress unless we start breaking up the erase
Though there ends up being a lot in executable.cmake as blits still need the SDK
@Gadgetoid
Copy link
Contributor

Gadgetoid commented Feb 27, 2025

I wonder if we can get a USB PID for "32blit SDK on RP2xxx"

I can certainly ask RPi for an allocation!

Edit: Done. It's a bit of a long shot since this is an SDK and not a single device, but you don't know if you don't ask.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants